#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["ARW.WebApi/ARW.WebApi.csproj", "ARW.WebApi/"]
COPY ["ARW.CodeGenerator/ARW.CodeGenerator.csproj", "ARW.CodeGenerator/"]
COPY ["Infrastructure/Infrastructure.csproj", "Infrastructure/"]
COPY ["ARW.Common/ARW.Common.csproj", "ARW.Common/"]
COPY ["ARW.Model/ARW.Model.csproj", "ARW.Model/"]
COPY ["ARW.Service/ARW.Service.csproj", "ARW.Service/"]
COPY ["ARW.Repository/ARW.Repository.csproj", "ARW.Repository/"]
COPY ["ARW.Tasks/ARW.Tasks.csproj", "ARW.Tasks/"]
RUN dotnet restore "ARW.WebApi/ARW.WebApi.csproj"
COPY . .
WORKDIR "/src/ARW.WebApi"
RUN dotnet build "ARW.WebApi.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "ARW.WebApi.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ARW.WebApi.dll"]